<?php

namespace addons\prl\controller;
use addons\prl\model\Channels as ChannelsModel;
use addons\prl\model\Views as ViewsModel;

class Index extends Base
{

    protected $noNeedLogin = '*';
    protected $noNeedRight = '*';
    protected $layout = '';

    public function _initialize()
    {
        $id = $this->request->param('id');
        $this->current_channel = (new ChannelsModel)->channel()->channelorder()->home()->find();
        if(empty($this->current_channel))
            return $this->error('栏目未找到！');

        $this->view_type = 0;
        parent::_initialize();
    }

    //首页
    public function index()
    {
        $viewName = ViewsModel::where('id', $this->current_channel->home_view_id)->value('tpl');
        return $this->show($viewName);
    }

    
}
